summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-11-20 17:36:35 +0100
committert895 <clombardo169@gmail.com>2023-11-25 06:47:36 +0100
commitf542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0 (patch)
tree8fbc73a07ec182fa6ca12164e242a0ccdd31221c
parentcore: Define HAS_NCE macro (diff)
downloadyuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar.gz
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar.bz2
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar.lz
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar.xz
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.tar.zst
yuzu-f542a3bb7aaca4a7560e9fcaa2e9b4305f9856c0.zip
-rw-r--r--src/core/arm/nce/patch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/arm/nce/patch.cpp b/src/core/arm/nce/patch.cpp
index bc4b73634..30c3c6cdd 100644
--- a/src/core/arm/nce/patch.cpp
+++ b/src/core/arm/nce/patch.cpp
@@ -20,6 +20,7 @@ using namespace oaknut::util;
using NativeExecutionParameters = Kernel::KThread::NativeExecutionParameters;
constexpr size_t MaxRelativeBranch = 128_MiB;
+constexpr u32 ModuleCodeIndex = 0x24 / sizeof(u32);
Patcher::Patcher() : c(m_patch_instructions) {}
@@ -42,7 +43,7 @@ void Patcher::PatchText(const Kernel::PhysicalMemory& program_image,
std::span<const u32>{reinterpret_cast<const u32*>(text.data()), text.size() / sizeof(u32)};
// Loop through instructions, patching as needed.
- for (u32 i = 0; i < static_cast<u32>(text_words.size()); i++) {
+ for (u32 i = ModuleCodeIndex; i < static_cast<u32>(text_words.size()); i++) {
const u32 inst = text_words[i];
const auto AddRelocations = [&] {
@@ -161,8 +162,8 @@ void Patcher::RelocateAndCopy(Common::ProcessAddress load_base,
}
// Cortex-A57 seems to treat all exclusives as ordered, but newer processors do not.
- // Convert to ordered to preserve this assumption
- for (u32 i = 0; i < static_cast<u32>(text_words.size()); i++) {
+ // Convert to ordered to preserve this assumption.
+ for (u32 i = ModuleCodeIndex; i < static_cast<u32>(text_words.size()); i++) {
const u32 inst = text_words[i];
if (auto exclusive = Exclusive{inst}; exclusive.Verify()) {
text_words[i] = exclusive.AsOrdered();